<template>
    <div class="container">
        <div class="head-area">
            <!-- <img class="icon-img" src="@/assets/vue.svg" /> -->
        </div>
        <div class="content-title">
            <h3 class="title-text">修改密码</h3>
        </div>
        <div class="content-area">
            <div class="input-area">
                <a-form :model="formState" name="normal_login" class="login-form" @finish="onFinish"
                    @finishFailed="onFinishFailed">

                    <a-form-item label="原密码" name="oldPassword" :rules="[{ required: true, message: '密码不能为空!' }]">
                        <a-input v-model:value="formState.password" placeholder="原密码">
                        </a-input>
                    </a-form-item>

                    <a-form-item label="新密码" name="newPassword" :rules="[{ required: true, message: '密码不能为空!' }]">
                        <a-input v-model:value="formState.password" placeholder="新密码">
                        </a-input>
                    </a-form-item>

                    <a-form-item label="确认密码" name="confirmPassword" :rules="[{ required: true, message: '密码不能为空!' }]">
                        <a-input v-model:value="formState.password" placeholder="确认密码">
                        </a-input>
                    </a-form-item>


                    <a-form-item class="button-area">
                        <a-button  type="primary" html-type="submit" class="login-form-button">
                            确定
                        </a-button>
                        <a-button type="primary" html-type="submit" class="login-form-button cancel-button">
                            取消
                        </a-button>
                    </a-form-item>
                </a-form>
            </div>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { defineComponent, reactive, computed } from 'vue';
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue';
import { post } from '@/service/request';


interface FormState {
    username: string;
    password: string;
    remember: boolean;
}

const formState = reactive<FormState>({
    username: '',
    password: '',
    remember: true,
});
const onFinish = async (values: any) => {
    // console.log('Success:', values);
    let postParam = { phone: values.username, password: values.password };
    const result = await post(`/api/users/login`, postParam);
};

const onFinishFailed = (errorInfo: any) => {
    console.log('Failed:', errorInfo);
};
const disabled = computed(() => {
    return !(formState.username && formState.password);
});

</script>
<style lang="less" scoped>
.container {
    width: 100vw;
    height: 100vh;
    background-color: #fff;

    display: flex;
    flex-direction: column;
    align-items: center;

    :deep(.ant-form-item-control-input-content) {
        display: flex;
        justify-content: space-between;
    }

    :deep(.ant-form-item) {
        margin: 0px;
        margin-bottom: 10px;
    }

    :deep(.button-area) {
        margin-top: 40px;
    }
}

.head-area {
    width: 100vw;
    height: 60px;
    border-bottom: 2px #1890ff36 solid;

    display: flex;
    align-items: center;

    .icon-img {
        margin-left: 20vw;
    }
}

.content-title {
    width: 400px;
    height: 50px;
    background: #1890ff;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 100px;
}

.content-area {
    width: 400px;
    height: 300px;
    margin-bottom: 50px;
    box-shadow: 2px 3px 20px 2px #1890ff5c;

    padding: 30px 50px 30px 50px;
}

.title-text {
    margin: 0;
    color: #eee;
}

.input-area {
    margin-top: 20px;
}


.login-form-button {
    width: 30%;
}

.cancel-button {
    background: #f5f5f5;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
}
</style>
